package com.zzyl.controller.customer;

import com.zzyl.base.ResponseResult;
import com.zzyl.dto.DeviceDto;
import com.zzyl.service.DeviceService;
import com.zzyl.vo.DeviceDataGraphVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/customer/user")
@Api(tags = "小程序端用户相关接口")
public class CustomerUserController {

    @Autowired
    private DeviceService deviceService;

    @PostMapping("/QueryDevicePropertyStatus")
    @ApiOperation("查询老人设备物模型状态信息")
    public ResponseResult<Map<String, Object>> queryDevicePropertyStatus(@RequestBody DeviceDto deviceDto) {
        return ResponseResult.success(deviceService.queryDevicePropertyStatus(deviceDto));
    }

    @GetMapping("/queryDeviceDataListByDay")
    @ApiOperation("查询老人设备日数据列表")
    public ResponseResult<List<DeviceDataGraphVo>> queryDeviceDataListByDay(String iotId, String functionId, Long startTime, Long endTime){
        return ResponseResult.success(deviceService.queryDeviceDataListByDay(iotId, functionId, startTime, endTime));
    }

    @GetMapping("/queryDeviceDataListByWeek")
    @ApiOperation("查询老人设备周数据列表")
    public ResponseResult<List<DeviceDataGraphVo>> queryDeviceDataListByWeek(String iotId, String functionId, Long startTime, Long endTime){
        return ResponseResult.success(deviceService.queryDeviceDataListByWeek(iotId, functionId, startTime, endTime));
    }
}
